/* CSS for Chinese Coffee Culture Matching Game */
/* Responsive design for iframe (450px height) and full browser (90vh) */
/* Modified for refined coffee cups and Chinese instructions */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 50%, #F4A460 100%);
    overflow: hidden;
    user-select: none;
    /* Detect if in iframe or full browser */
    height: 450px;
    width: 100%;
}

/* Full browser height detection */
@media screen and (min-height: 500px) {
    body {
        height: 90vh;
    }
}

#gameContainer {
    width: 100%;
    height: 100%;
    position: relative;
    background: 
        radial-gradient(circle at 20% 80%, rgba(139, 69, 19, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(210, 105, 30, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, #F5DEB3 0%, #DEB887 100%);
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(139, 69, 19, 0.2);
}

/* Game header with score and controls */
#gameHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: rgba(139, 69, 19, 0.8);
    color: white;
    font-weight: bold;
    height: 40px;
    backdrop-filter: blur(5px);
}

#scoreDisplay {
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#resetBtn, #playAgainBtn {
    background: linear-gradient(145deg, #CD853F, #A0522D);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    min-height: 28px;
    white-space: nowrap;
}

#resetBtn:hover, #playAgainBtn:hover {
    background: linear-gradient(145deg, #D2691E, #8B4513);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

/* Main game area */
#gameArea {
    position: relative;
    width: 100%;
    height: calc(100% - 40px);
    overflow: hidden;
}

/* Coffee cups container - Modified for 5 cups layout */
#cupsContainer {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    flex-wrap: nowrap;
    padding: 0 10px;
    height: 120px;
}

/* Individual coffee cup styling - More refined design */
.coffee-cup {
    width: 85px;
    height: 85px;
    background: 
        linear-gradient(to bottom, 
            #F5F5DC 0%, 
            #F0E68C 20%, 
            #DEB887 60%, 
            #D2B48C 100%);
    border: 3px solid #654321;
    border-radius: 0 0 42px 42px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
    box-shadow: 
        0 6px 12px rgba(0,0,0,0.4),
        inset 0 3px 6px rgba(255,255,255,0.4),
        inset 0 -2px 4px rgba(139, 69, 19, 0.3);
    /* Added coffee liquid effect */
}

/* Coffee liquid inside cup - refined effect */
.coffee-cup::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 8px;
    right: 8px;
    height: 45px;
    background: 
        radial-gradient(ellipse at center top, 
            #8B4513 0%, 
            #654321 40%, 
            #3E2723 100%);
    border-radius: 0 0 35px 35px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    z-index: 1;
}

/* Coffee cup handle - more refined */
.coffee-cup::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -18px;
    width: 22px;
    height: 30px;
    border: 3px solid #654321;
    border-left: none;
    border-radius: 0 18px 18px 0;
    background: transparent;
    box-shadow: 
        inset -2px 0 4px rgba(139, 69, 19, 0.3),
        2px 2px 4px rgba(0,0,0,0.2);
}

/* Coffee cup saucer base - refined */
.coffee-cup {
    border-bottom: 8px solid #8B4513;
    border-bottom-left-radius: 50px;
    border-bottom-right-radius: 50px;
}

.coffee-cup.highlight {
    transform: scale(1.1);
    box-shadow: 
        0 0 20px rgba(34, 139, 34, 0.8),
        0 6px 12px rgba(0,0,0,0.4),
        inset 0 3px 6px rgba(255,255,255,0.4);
}

.coffee-cup.correct {
    background: 
        linear-gradient(to bottom, 
            #E6FFE6 0%, 
            #B3FFB3 20%, 
            #80FF80 60%, 
            #4DFF4D 100%);
    animation: correctPulse 0.6s ease-in-out;
}

.coffee-cup.incorrect {
    background: 
        linear-gradient(to bottom, 
            #FFE6E6 0%, 
            #FFB3B3 20%, 
            #FF8080 60%, 
            #FF4D4D 100%);
    animation: incorrectShake 0.6s ease-in-out;
}

/* Coffee cup text - positioned above coffee liquid */
.cup-text {
    color: #2F1B14;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.7);
    z-index: 2;
    position: relative;
    background: rgba(245, 245, 220, 0.8);
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid rgba(139, 69, 19, 0.3);
}

/* Falling saucers */
.saucer {
    position: absolute;
    width: 60px;
    height: 60px;
    background: 
        radial-gradient(ellipse at center, #F5DEB3 0%, #DEB887 80%, #8B4513 100%);
    border: 2px solid #8B4513;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(255,255,255,0.3);
    z-index: 10;
}

.saucer:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 15px rgba(255, 215, 0, 0.6),
        0 4px 8px rgba(0,0,0,0.3);
}

.saucer.caught {
    background: radial-gradient(ellipse at center, #FFD700 0%, #FFA500 100%);
    animation: catchGlow 0.3s ease-in-out;
}

.saucer-text {
    color: #8B4513;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

/* Feedback overlay */
#feedbackOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: bold;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feedback-correct {
    color: #32CD32;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: feedbackPop 1s ease-in-out;
}

.feedback-incorrect {
    color: #FF6B6B;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: feedbackPop 1s ease-in-out;
}

/* Game completion modal */
#gameComplete {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#completionMessage {
    background: linear-gradient(135deg, #F5DEB3, #DEB887);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    border: 3px solid #8B4513;
}

#completionMessage h2 {
    color: #8B4513;
    margin-bottom: 10px;
    font-size: 20px;
}

#completionMessage p {
    color: #8B4513;
    margin-bottom: 15px;
    font-size: 16px;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes catchGlow {
    0% { box-shadow: 0 4px 8px rgba(0,0,0,0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
    100% { box-shadow: 0 4px 8px rgba(0,0,0,0.3); }
}

@keyframes feedbackPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    top: 50px;
    right: 15px;
    background: rgba(139, 69, 19, 0.9);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    max-width: 200px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tooltip.show {
    opacity: 1;
}

/* Mobile responsiveness - Adjusted for 5 cups */
@media (max-width: 768px) {
    .coffee-cup {
        width: 75px;
        height: 75px;
    }
    
    .cup-text {
        font-size: 12px;
    }
    
    .saucer {
        width: 50px;
        height: 50px;
    }
    
    .saucer-text {
        font-size: 10px;
    }
    
    #cupsContainer {
        height: 100px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .coffee-cup:active {
        transform: scale(1.1);
    }
    
    .saucer:active {
        transform: scale(1.1);
    }
}